package ar.org.fiel.tarifasocial.om.base;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;

import ar.org.fiel.tarifasocial.om.model.*;

import ar.org.fiel.tarifasocial.om.peer.*;

                    

/**
 * This class was autogenerated by Torque on:
 *
 * [Mon Jun 18 20:18:58 ART 2007]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to Document
 */
public abstract class BaseDocument extends BaseObject
{
    /** The Peer class */
    private static final DocumentPeer peer =
        new DocumentPeer();

        
    /** The value for the id field */
    private Integer id;
      
    /** The value for the name field */
    private String name;
      
    /** The value for the author field */
    private String author;
      
    /** The value for the description field */
    private String description;
      
    /** The value for the fileName field */
    private String fileName;
      
    /** The value for the sectorId field */
    private Integer sectorId;
  
            
    /**
     * Get the Id
     *
     * @return Integer
     */
    public Integer getId()
    {
        return id;
    }

                                              
    /**
     * Set the value of Id
     *
     * @param v new value
     */
    public void setId(Integer v) throws TorqueException
    {
    
                  if (!ObjectUtils.equals(this.id, v))
              {
            this.id = v;
            setModified(true);
        }
    
          
                                  
                  // update associated Download
        if (collDownloads != null)
        {
            for (int i = 0; i < collDownloads.size(); i++)
            {
                ((Download) collDownloads.get(i))
                    .setDocumentId(v);
            }
        }
                                                    
                  // update associated DocumentItem
        if (collDocumentItems != null)
        {
            for (int i = 0; i < collDocumentItems.size(); i++)
            {
                ((DocumentItem) collDocumentItems.get(i))
                    .setDocumentId(v);
            }
        }
                                }
          
    /**
     * Get the Name
     *
     * @return String
     */
    public String getName()
    {
        return name;
    }

                        
    /**
     * Set the value of Name
     *
     * @param v new value
     */
    public void setName(String v) 
    {
    
                  if (!ObjectUtils.equals(this.name, v))
              {
            this.name = v;
            setModified(true);
        }
    
          
              }
          
    /**
     * Get the Author
     *
     * @return String
     */
    public String getAuthor()
    {
        return author;
    }

                        
    /**
     * Set the value of Author
     *
     * @param v new value
     */
    public void setAuthor(String v) 
    {
    
                  if (!ObjectUtils.equals(this.author, v))
              {
            this.author = v;
            setModified(true);
        }
    
          
              }
          
    /**
     * Get the Description
     *
     * @return String
     */
    public String getDescription()
    {
        return description;
    }

                        
    /**
     * Set the value of Description
     *
     * @param v new value
     */
    public void setDescription(String v) 
    {
    
                  if (!ObjectUtils.equals(this.description, v))
              {
            this.description = v;
            setModified(true);
        }
    
          
              }
          
    /**
     * Get the FileName
     *
     * @return String
     */
    public String getFileName()
    {
        return fileName;
    }

                        
    /**
     * Set the value of FileName
     *
     * @param v new value
     */
    public void setFileName(String v) 
    {
    
                  if (!ObjectUtils.equals(this.fileName, v))
              {
            this.fileName = v;
            setModified(true);
        }
    
          
              }
          
    /**
     * Get the SectorId
     *
     * @return Integer
     */
    public Integer getSectorId()
    {
        return sectorId;
    }

                              
    /**
     * Set the value of SectorId
     *
     * @param v new value
     */
    public void setSectorId(Integer v) throws TorqueException
    {
    
                  if (!ObjectUtils.equals(this.sectorId, v))
              {
            this.sectorId = v;
            setModified(true);
        }
    
                                  
                if (aSector != null && !ObjectUtils.equals(aSector.getId(), v))
                {
            aSector = null;
        }
      
              }
  
      
        
                  
    
        private Sector aSector;

    /**
     * Declares an association between this object and a Sector object
     *
     * @param v Sector
     * @throws TorqueException
     */
    public void setSector(Sector v) throws TorqueException
    {
            if (v == null)
        {
                  setSectorId((Integer) null);
              }
        else
        {
            setSectorId(v.getId());
        }
            aSector = v;
    }

                        
    /**
     * Returns the associated Sector object.
           * If it was not retrieved before, the object is retrieved from
     * the database
           *
     * @return the associated Sector object
           * @throws TorqueException
           */
    public Sector getSector()
              throws TorqueException
          {
              if (aSector == null && (!ObjectUtils.equals(this.sectorId, null)))
        {
                              aSector = SectorPeer.retrieveByPK(SimpleKey.keyFor(this.sectorId));
                  
            /* The following can be used instead of the line above to
               guarantee the related object contains a reference
               to this object, but this level of coupling
               may be undesirable in many circumstances.
               As it can lead to a db query with many results that may
               never be used.
               Sector obj = SectorPeer.retrieveByPK(this.sectorId);
               obj.add${pCollName}(this);
            */
        }
              return aSector;
    }

    /**
     * Return the associated Sector object
     * If it was not retrieved before, the object is retrieved from
     * the database using the passed connection
     *
     * @param connection the connection used to retrieve the associated object
     *        from the database, if it was not retrieved before
     * @return the associated Sector object
     * @throws TorqueException
     */
    public Sector getSector(Connection connection)
        throws TorqueException
    {
        if (aSector == null && (!ObjectUtils.equals(this.sectorId, null)))
        {
                          aSector = SectorPeer.retrieveByPK(SimpleKey.keyFor(this.sectorId), connection);
              
            /* The following can be used instead of the line above to
               guarantee the related object contains a reference
               to this object, but this level of coupling
               may be undesirable in many circumstances.
               As it can lead to a db query with many results that may
               never be used.
               Sector obj = SectorPeer.retrieveByPK(this.sectorId, connection);
               obj.add${pCollName}(this);
            */
        }
        return aSector;
    }

    /**
     * Provides convenient way to set a relationship based on a
     * ObjectKey, for example
     * <code>bar.setFooKey(foo.getPrimaryKey())</code>
     *
         */
    public void setSectorKey(ObjectKey key) throws TorqueException
    {
      
                        setSectorId(new Integer(((NumberKey) key).intValue()));
                  }
       
                                
            
          /**
     * Collection to store aggregation of collDownloads
     */
    protected List collDownloads;

    /**
     * Temporary storage of collDownloads to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initDownloads()
    {
        if (collDownloads == null)
        {
            collDownloads = new ArrayList();
        }
    }

        
    /**
     * Method called to associate a Download object to this object
     * through the Download foreign key attribute
     *
     * @param l Download
     * @throws TorqueException
     */
    public void addDownload(Download l) throws TorqueException
    {
        getDownloads().add(l);
        l.setDocument((Document) this);
    }

    /**
     * The criteria used to select the current contents of collDownloads
     */
    private Criteria lastDownloadsCriteria = null;
      
    /**
                   * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getDownloads(new Criteria())
                   *
     * @return the collection of associated objects
           * @throws TorqueException
           */
    public List getDownloads()
              throws TorqueException
          {
                      if (collDownloads == null)
        {
            collDownloads = getDownloads(new Criteria(10));
        }
                return collDownloads;
          }

    /**
           * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Document has previously
           * been saved, it will retrieve related Downloads from storage.
     * If this Document is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getDownloads(Criteria criteria) throws TorqueException
    {
              if (collDownloads == null)
        {
            if (isNew())
            {
               collDownloads = new ArrayList();
            }
            else
            {
                        criteria.add(DownloadPeer.DOW_DOC_ID, getId() );
                        collDownloads = DownloadPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                            criteria.add(DownloadPeer.DOW_DOC_ID, getId());
                            if (!lastDownloadsCriteria.equals(criteria))
                {
                    collDownloads = DownloadPeer.doSelect(criteria);
                }
            }
        }
        lastDownloadsCriteria = criteria;

        return collDownloads;
          }

    /**
           * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getDownloads(new Criteria(),Connection)
           * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getDownloads(Connection con) throws TorqueException
    {
              if (collDownloads == null)
        {
            collDownloads = getDownloads(new Criteria(10), con);
        }
        return collDownloads;
          }

    /**
           * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Document has previously
           * been saved, it will retrieve related Downloads from storage.
     * If this Document is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getDownloads(Criteria criteria, Connection con)
            throws TorqueException
    {
              if (collDownloads == null)
        {
            if (isNew())
            {
               collDownloads = new ArrayList();
            }
            else
            {
                         criteria.add(DownloadPeer.DOW_DOC_ID, getId());
                         collDownloads = DownloadPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                             criteria.add(DownloadPeer.DOW_DOC_ID, getId());
                             if (!lastDownloadsCriteria.equals(criteria))
                 {
                     collDownloads = DownloadPeer.doSelect(criteria, con);
                 }
             }
         }
         lastDownloadsCriteria = criteria;

         return collDownloads;
           }

                        
              
                    
                    
                                
                                                              
                                        
                    
                    
          
    /**
                 * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Document is new, it will return
                 * an empty collection; or if this Document has previously
     * been saved, it will retrieve related Downloads from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Document.
     */
    protected List getDownloadsJoinUser(Criteria criteria)
        throws TorqueException
    {
                    if (collDownloads == null)
        {
            if (isNew())
            {
               collDownloads = new ArrayList();
            }
            else
            {
                              criteria.add(DownloadPeer.DOW_DOC_ID, getId());
                              collDownloads = DownloadPeer.doSelectJoinUser(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
                                    criteria.add(DownloadPeer.DOW_DOC_ID, getId());
                                    if (!lastDownloadsCriteria.equals(criteria))
            {
                collDownloads = DownloadPeer.doSelectJoinUser(criteria);
            }
        }
        lastDownloadsCriteria = criteria;

        return collDownloads;
                }
                  
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
                 * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Document is new, it will return
                 * an empty collection; or if this Document has previously
     * been saved, it will retrieve related Downloads from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Document.
     */
    protected List getDownloadsJoinDocument(Criteria criteria)
        throws TorqueException
    {
                    if (collDownloads == null)
        {
            if (isNew())
            {
               collDownloads = new ArrayList();
            }
            else
            {
                              criteria.add(DownloadPeer.DOW_DOC_ID, getId());
                              collDownloads = DownloadPeer.doSelectJoinDocument(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
                                    criteria.add(DownloadPeer.DOW_DOC_ID, getId());
                                    if (!lastDownloadsCriteria.equals(criteria))
            {
                collDownloads = DownloadPeer.doSelectJoinDocument(criteria);
            }
        }
        lastDownloadsCriteria = criteria;

        return collDownloads;
                }
                            


                          
            
          /**
     * Collection to store aggregation of collDocumentItems
     */
    protected List collDocumentItems;

    /**
     * Temporary storage of collDocumentItems to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initDocumentItems()
    {
        if (collDocumentItems == null)
        {
            collDocumentItems = new ArrayList();
        }
    }

        
    /**
     * Method called to associate a DocumentItem object to this object
     * through the DocumentItem foreign key attribute
     *
     * @param l DocumentItem
     * @throws TorqueException
     */
    public void addDocumentItem(DocumentItem l) throws TorqueException
    {
        getDocumentItems().add(l);
        l.setDocument((Document) this);
    }

    /**
     * The criteria used to select the current contents of collDocumentItems
     */
    private Criteria lastDocumentItemsCriteria = null;
      
    /**
                   * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getDocumentItems(new Criteria())
                   *
     * @return the collection of associated objects
           * @throws TorqueException
           */
    public List getDocumentItems()
              throws TorqueException
          {
                      if (collDocumentItems == null)
        {
            collDocumentItems = getDocumentItems(new Criteria(10));
        }
                return collDocumentItems;
          }

    /**
           * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Document has previously
           * been saved, it will retrieve related DocumentItems from storage.
     * If this Document is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getDocumentItems(Criteria criteria) throws TorqueException
    {
              if (collDocumentItems == null)
        {
            if (isNew())
            {
               collDocumentItems = new ArrayList();
            }
            else
            {
                        criteria.add(DocumentItemPeer.DIT_DOC_ID, getId() );
                        collDocumentItems = DocumentItemPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                            criteria.add(DocumentItemPeer.DIT_DOC_ID, getId());
                            if (!lastDocumentItemsCriteria.equals(criteria))
                {
                    collDocumentItems = DocumentItemPeer.doSelect(criteria);
                }
            }
        }
        lastDocumentItemsCriteria = criteria;

        return collDocumentItems;
          }

    /**
           * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getDocumentItems(new Criteria(),Connection)
           * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getDocumentItems(Connection con) throws TorqueException
    {
              if (collDocumentItems == null)
        {
            collDocumentItems = getDocumentItems(new Criteria(10), con);
        }
        return collDocumentItems;
          }

    /**
           * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Document has previously
           * been saved, it will retrieve related DocumentItems from storage.
     * If this Document is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getDocumentItems(Criteria criteria, Connection con)
            throws TorqueException
    {
              if (collDocumentItems == null)
        {
            if (isNew())
            {
               collDocumentItems = new ArrayList();
            }
            else
            {
                         criteria.add(DocumentItemPeer.DIT_DOC_ID, getId());
                         collDocumentItems = DocumentItemPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                             criteria.add(DocumentItemPeer.DIT_DOC_ID, getId());
                             if (!lastDocumentItemsCriteria.equals(criteria))
                 {
                     collDocumentItems = DocumentItemPeer.doSelect(criteria, con);
                 }
             }
         }
         lastDocumentItemsCriteria = criteria;

         return collDocumentItems;
           }

                        
              
                    
                    
                                
                                                              
                                        
                    
                    
          
    /**
                 * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Document is new, it will return
                 * an empty collection; or if this Document has previously
     * been saved, it will retrieve related DocumentItems from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Document.
     */
    protected List getDocumentItemsJoinSection(Criteria criteria)
        throws TorqueException
    {
                    if (collDocumentItems == null)
        {
            if (isNew())
            {
               collDocumentItems = new ArrayList();
            }
            else
            {
                              criteria.add(DocumentItemPeer.DIT_DOC_ID, getId());
                              collDocumentItems = DocumentItemPeer.doSelectJoinSection(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
                                    criteria.add(DocumentItemPeer.DIT_DOC_ID, getId());
                                    if (!lastDocumentItemsCriteria.equals(criteria))
            {
                collDocumentItems = DocumentItemPeer.doSelectJoinSection(criteria);
            }
        }
        lastDocumentItemsCriteria = criteria;

        return collDocumentItems;
                }
                  
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
                 * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Document is new, it will return
                 * an empty collection; or if this Document has previously
     * been saved, it will retrieve related DocumentItems from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Document.
     */
    protected List getDocumentItemsJoinDocument(Criteria criteria)
        throws TorqueException
    {
                    if (collDocumentItems == null)
        {
            if (isNew())
            {
               collDocumentItems = new ArrayList();
            }
            else
            {
                              criteria.add(DocumentItemPeer.DIT_DOC_ID, getId());
                              collDocumentItems = DocumentItemPeer.doSelectJoinDocument(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
                                    criteria.add(DocumentItemPeer.DIT_DOC_ID, getId());
                                    if (!lastDocumentItemsCriteria.equals(criteria))
            {
                collDocumentItems = DocumentItemPeer.doSelectJoinDocument(criteria);
            }
        }
        lastDocumentItemsCriteria = criteria;

        return collDocumentItems;
                }
                            


          
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
          save(DocumentPeer.getMapBuilder()
                .getDatabaseMap().getName());
      }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
       * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
       *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
          try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
      }

      /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
      /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
          if (!alreadyInSave)
        {
            alreadyInSave = true;


  
            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    DocumentPeer.doInsert((Document) this, con);
                    setNew(false);
                }
                else
                {
                    DocumentPeer.doUpdate((Document) this, con);
                }
                }

                                      
                                    if (collDownloads != null)
            {
                for (int i = 0; i < collDownloads.size(); i++)
                {
                    ((Download) collDownloads.get(i)).save(con);
                }
            }
                                                  
                                    if (collDocumentItems != null)
            {
                for (int i = 0; i < collDocumentItems.size(); i++)
                {
                    ((DocumentItem) collDocumentItems.get(i)).save(con);
                }
            }
                                  alreadyInSave = false;
        }
      }

                        
      /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param key id ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        throws TorqueException
    {
            setId(new Integer(((NumberKey) key).intValue()));
        }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) throws TorqueException
    {
            setId(new Integer(key));
        }

  
    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
          return SimpleKey.keyFor(getId());
      }
 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
       * It then fills all the association collections and sets the
     * related objects to isNew=true.
       */
      public Document copy() throws TorqueException
    {
        return copyInto(new Document());
    }
  
    protected Document copyInto(Document copyObj) throws TorqueException
    {
          copyObj.setId(id);
          copyObj.setName(name);
          copyObj.setAuthor(author);
          copyObj.setDescription(description);
          copyObj.setFileName(fileName);
          copyObj.setSectorId(sectorId);
  
                    copyObj.setId((Integer)null);
                                          
                                      
                            
        List v = getDownloads();
                            if (v != null)
        {
            for (int i = 0; i < v.size(); i++)
            {
                Download obj = (Download) v.get(i);
                copyObj.addDownload(obj.copy());
            }
        }
        else
        {
            copyObj.collDownloads = null;
        }
                                                  
                            
        v = getDocumentItems();
                            if (v != null)
        {
            for (int i = 0; i < v.size(); i++)
            {
                DocumentItem obj = (DocumentItem) v.get(i);
                copyObj.addDocumentItem(obj.copy());
            }
        }
        else
        {
            copyObj.collDocumentItems = null;
        }
                            return copyObj;
    }

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public DocumentPeer getPeer()
    {
        return peer;
    }


    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Document:\n");
        str.append("Id = ")
               .append(getId())
             .append("\n");
        str.append("Name = ")
               .append(getName())
             .append("\n");
        str.append("Author = ")
               .append(getAuthor())
             .append("\n");
        str.append("Description = ")
               .append(getDescription())
             .append("\n");
        str.append("FileName = ")
               .append(getFileName())
             .append("\n");
        str.append("SectorId = ")
               .append(getSectorId())
             .append("\n");
        return(str.toString());
    }
}
